package controller

import (
	"context"
	"fmt"
	"github.com/golang/glog"
	"micro-client/modules/mysql"
	"micro-client/vender/article/funcStruct"
	"micro-client/vender/article/service"
)

type ModelConf struct{}

func (mc *ModelConf) Get(ctx context.Context, args *funcStruct.Args, reply *funcStruct.Reply) error {
	fmt.Println(ctx)
	data, err := service.GetConf(mysqlServer.BusinessDB, args.Key, args.Limit)
	if err != nil {
		glog.Error(err)
	}
	for _, v := range data {
		a := make(map[string]interface{}, 0)
		a[v.Key] = v.Value
		reply.Data = append(reply.Data, a)
	}
	return nil
}
